Loading TOC...

MarkLogic Server 11.0 Product Documentation
GET /v1/config/namespaces/{prefix}

Summary

[DEPRECATED: Use GET /manage/v2/servers/{id|name}/properties instead.]

Retrieve the namespace URI associated with the REST service namespace binding prefix {prefix}.

URL Parameters
format? The expected format of the response, either xml or json. Overrides the format specified in the Accept header.
Request Headers
Accept* The expected MIME type of the response, either application/json or application/XML (the default). If the format parameter is set, the Accept header is ignored in favor of the format parameter.
Response Headers
Content-Type The MIME type of the content returned in the response body, either application/xml or application/json.

Response

Upon success, MarkLogic Server returns status 200 and returns the requested information in the response body, as either XML or JSON. If no namespace binding exists for {prefix}, MarkLogic server returns 404 (Not Found).

The response body has the following format when requesting XML:

  <namespace xmlns="http://marklogic.com/rest-api">
    <prefix>the-prefix</prefix>
    <uri>the-uri</uri>
  </namespace>
    

The response body has the following format when requesting JSON:

  { "prefix" : "the-prefix", "uri" : "the-uri" }
    

Required Privileges

This operation requires the rest-reader role, or the following privilege:

http://marklogic.com/xdmp/privileges/rest-reader

Usage Notes

For details, see Using Namespace Bindings in the REST Application Developer's Guide.

The expected response type can be specified using either the format parameter or Accept header. One or the other must be supplied. If both are supplied and are different, the format parameter takes precedence.

Example

$ curl --anyauth --user user:password -i -X GET -H "Accept: application/xml" \
    'http://localhost:8004/v1/config/namespaces/will'

==> MarkLogic Server responds with status 200 and returns the namespace
    binding information for prefix "will", as XML. For example:

Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close

HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 170
Connection: close

<rapi:namespace xmlns:rapi="http://marklogic.com/rest-api">
  <rapi:prefix>will</rapi:prefix>
  <rapi:uri>http://marklogic.com/examples/shakespeare</rapi:uri>
</rapi:namespace>
  

Example

$ curl --anyauth --user user:password -X GET -i -H "Accept: application/json" \
    'http://localhost:8004/v1/config/namespaces/will'

==> MarkLogic Server responds with status 200 and returns the namespace
    binding information for prefix "will", as JSON. For example:

Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close

HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 67
Connection: close

{
  "prefix":"will",
  "uri":"http://marklogic.com/examples/shakespeare"
}
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.